﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp2
{
    public partial class Login : Form
    {
        public Login()
        {
            InitializeComponent();
        }

        public  static Dictionary<string, string> _user = new Dictionary<string, string>();

        private void Login_Load(object sender, EventArgs e)
        {
            _user.Add("sa","123");
        }
        private void button2_Click(object sender, EventArgs e)
        {
            

            var uid = username.Text;
            var pwd = password.Text;
            var res = _user.Where(x=>x.Key==uid).FirstOrDefault();

            if (res.Key==uid && res.Value==pwd)
            {
                MessageBox.Show("登入成功","登入结果框",MessageBoxButtons.OK,MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("密码或账号错误！", "登入结果框",MessageBoxButtons.OK,MessageBoxIcon.Warning);
            }
           
        
            
        }

        private void button1_Click(object sender, EventArgs e)
        {
           var pd = MessageBox.Show("是否确前往注册！", "注册界面！",MessageBoxButtons.YesNo,MessageBoxIcon.Information);
            if (pd ==DialogResult.Yes)
            {
                var enroll = new Enroll();
                enroll.Show();
            }
            
        }

       
    }
}
